package com.intermancer.trader.signal;

import java.util.UUID;

public class BaseTradeSignal implements TradeSignal {
	
	private UUID id;
	private TradeSignalType tradeSignalType;
	private UUID referenceTradeSignalId;

	public UUID getId() {
		return id;
	}
	
	public void setId(UUID id) {
		this.id = id;
	}
	
	public TradeSignalType getTradeSignalType() {
		return tradeSignalType;
	}
	
	public void setTradeSignalType(TradeSignalType tradeSignalType) {
		this.tradeSignalType = tradeSignalType;
	}

	public void setReferenceTradeSignalId(UUID referenceTradeSignalId) {
		this.referenceTradeSignalId = referenceTradeSignalId;
	}

	public UUID getReferenceTradeSignalId() {
		return referenceTradeSignalId;
	}

	@Override
	public boolean equals(Object obj) {
		TradeSignal other = null;
		if(obj != null && obj instanceof TradeSignal) {
			other = (TradeSignal) obj;
			if (this.tradeSignalType.equals(other.getTradeSignalType())) {
				if (TradeSignalType.EXIT.equals(other.getTradeSignalType())) {
					if (referenceTradeSignalId.equals(other.getReferenceTradeSignalId())) {
						return true;
					}
					return false;
				}
				return true;
			}
		}
		return false;
	}

	@Override
	public int hashCode() {
		return id.hashCode();
	}

}
